package com.woniuxy02;

interface MyInterface{
    void test();
}

class MyClass implements MyInterface{
    @Override
    public void test() {
        System.out.println("MyClass -- test");
    }
}

public class Test06 {
    public static void main(String[] args) {
        MyInterface myInterface1 = new MyClass();
        myInterface1.test();

        MyInterface myInterface2 =new MyInterface(){
            @Override
            public void test() {
                System.out.println("xxxx");
            }
        };
        myInterface2.test();

        new MyInterface(){
            @Override
            public void test() {
                System.out.println("yyyy");
            }
        }.test();

        //JDK1.8新增的语法：Lambda表达式
        ((MyInterface) () -> System.out.println("zzz")).test();

    }
}
